# Contributor: Alex McGrath <amk@amk.ie>
# Maintainer: Alex McGrath <amk@amk.ie>
pkgname=mupen64plus
pkgver=2.5.9
pkgrel=3
pkgdesc="Mupen64Plus is a cross-platform plugin-based N64 emulator."
url="https://mupen64plus.org/"
# build fails or is not officially supported for this release for all but x86_64
arch="x86_64"
license="GPL-2.0-only"
makedepends="
	boost-dev
	freetype-dev
	glu-dev
	libpng-dev
	libsamplerate-dev
	nasm
	sdl2-dev
	zlib-dev
	"
source="https://github.com/mupen64plus/mupen64plus-core/releases/download/$pkgver/mupen64plus-bundle-src-$pkgver.tar.gz
	gcc.patch
	fix-null-usage.patch
	fix-build.patch
	sdl2-pitch.patch
	"
options="!check" # no test suite
subpackages="$pkgname-doc"
builddir="$srcdir/mupen64plus-bundle-src-$pkgver"

build() {
	PIE=1 USE_GLES=1 ./m64p_build.sh
}

package() {
	PIE=1 USE_GLES=1 ./m64p_install.sh DESTDIR="$pkgdir" PREFIX='/usr'
}

sha512sums="
ba80c2ab2391d232b0ed6b96943a27d8e93cf1b3540a25a1a89fc5ba104cfcbb17cb81066ec6a0060b2159afb68eebbeb83536ae4a97779af6c52477e738cd5e  mupen64plus-bundle-src-2.5.9.tar.gz
9853bbb02fff179767c1499772ccb7dce4fcfd636b7bd188e9104d055943fd6e350b9edc0d8e1927fb0cc9bacedc9a6cf3f4972a5866da57ae3ca32d232b9582  gcc.patch
c3d24b5c83d7f3f87fb7cde8e8a16848b3bf2888f11b7b4b66cec819d8c880b6183fdb2c6ca13228ad20eb89197e0e63b231a43aaedb092167980e885409388d  fix-null-usage.patch
24ceedcf4de3c3fb83d2f1135c7d5a3d9250d80b964f871b0425c0f7e0e594a58efafb432ac475e3b52ed2889b295baf4d5561520aed3599aa2c41b01e2762e9  fix-build.patch
b8bcefa84034e767a3fdaa97bf7a87e9001200ff17ade89b88326e91ffb2f48ab9c531f3aed472bd555724af017da5ac96003952cd9aa9b4b95b167d399f4f29  sdl2-pitch.patch
"
